home *** CD-ROM | disk | FTP | other *** search
/ Champak 145 / (Vol 145) Dec 21 2011.iso / Interface / mod.000 / scripts / __Packages / mx / controls / RadioButton.as < prev    next >
Encoding:
Text File  |  2011-12-21  |  6.2 KB  |  231 lines

  1. class mx.controls.RadioButton extends mx.controls.Button
  2. {
  3.    var __value;
  4.    var selected;
  5.    var dispatchEvent;
  6.    var __data;
  7.    static var symbolName = "RadioButton";
  8.    static var symbolOwner = mx.controls.RadioButton;
  9.    static var version = "2.0.2.126";
  10.    var className = "RadioButton";
  11.    var btnOffset = 0;
  12.    var __toggle = true;
  13.    var __label = "Radio Button";
  14.    var __labelPlacement = "right";
  15.    var ignoreClassStyleDeclaration = {Button:1};
  16.    var __groupName = "radioGroup";
  17.    var indexNumber = 0;
  18.    var offset = false;
  19.    var falseUpSkin = "";
  20.    var falseDownSkin = "";
  21.    var falseOverSkin = "";
  22.    var falseDisabledSkin = "";
  23.    var trueUpSkin = "";
  24.    var trueDownSkin = "";
  25.    var trueOverSkin = "";
  26.    var trueDisabledSkin = "";
  27.    var falseUpIcon = "RadioFalseUp";
  28.    var falseDownIcon = "RadioFalseDown";
  29.    var falseOverIcon = "RadioFalseOver";
  30.    var falseDisabledIcon = "RadioFalseDisabled";
  31.    var trueUpIcon = "RadioTrueUp";
  32.    var trueDownIcon = "";
  33.    var trueOverIcon = "";
  34.    var trueDisabledIcon = "RadioTrueDisabled";
  35.    var centerContent = false;
  36.    var borderW = 0;
  37.    var clipParameters = {labelPlacement:1,data:1,label:1,groupName:1,selected:1};
  38.    static var mergedClipParameters = mx.core.UIObject.mergeClipParameters(mx.controls.RadioButton.prototype.clipParameters,mx.controls.Button.prototype.clipParameters);
  39.    function RadioButton()
  40.    {
  41.       super();
  42.    }
  43.    function init(Void)
  44.    {
  45.       this.setToggle(this.__toggle);
  46.       this.__value = this;
  47.       super.init();
  48.    }
  49.    function size(Void)
  50.    {
  51.       super.size();
  52.    }
  53.    function onRelease()
  54.    {
  55.       if(this.selected)
  56.       {
  57.          return undefined;
  58.       }
  59.       this.releaseFocus();
  60.       this.phase = "up";
  61.       this.setSelected(true);
  62.       this.dispatchEvent({type:"click"});
  63.       this._parent[this.__groupName].dispatchEvent({type:"click"});
  64.    }
  65.    function setData(val)
  66.    {
  67.       this.__data = val;
  68.    }
  69.    function set data(val)
  70.    {
  71.       this.__data = val;
  72.    }
  73.    function getData(val)
  74.    {
  75.       return this.__data;
  76.    }
  77.    function get data()
  78.    {
  79.       return this.__data;
  80.    }
  81.    function onUnload()
  82.    {
  83.       if(this._parent[this.__groupName].selectedRadio == this)
  84.       {
  85.          this._parent[this.__groupName].selectedRadio = undefined;
  86.       }
  87.       this._parent[this.__groupName].radioList[this.indexNumber] = null;
  88.       delete this._parent[this.__groupName].radioList[this.indexNumber];
  89.    }
  90.    function setSelected(val)
  91.    {
  92.       var _loc2_ = this._parent[this.__groupName];
  93.       var _loc4_ = _loc2_.selectedRadio.__width;
  94.       var _loc5_ = _loc2_.selectedRadio.__height;
  95.       if(val)
  96.       {
  97.          _loc2_.selectedRadio.setState(false);
  98.          _loc2_.selectedRadio = this;
  99.       }
  100.       else if(_loc2_.selectedRadio == this)
  101.       {
  102.          _loc2_.selectedRadio.setState(false);
  103.          _loc2_.selectedRadio = undefined;
  104.       }
  105.       this.setState(val);
  106.    }
  107.    function deleteGroupObj(groupName)
  108.    {
  109.       delete this._parent[groupName];
  110.    }
  111.    function getGroupName()
  112.    {
  113.       return this.__groupName;
  114.    }
  115.    function get groupName()
  116.    {
  117.       return this.__groupName;
  118.    }
  119.    function setGroupName(groupName)
  120.    {
  121.       if(groupName == undefined || groupName == "")
  122.       {
  123.          return undefined;
  124.       }
  125.       delete this._parent[this.__groupName].radioList[this.__data];
  126.       this.addToGroup(groupName);
  127.       this.__groupName = groupName;
  128.    }
  129.    function set groupName(groupName)
  130.    {
  131.       this.setGroupName(groupName);
  132.    }
  133.    function addToGroup(groupName)
  134.    {
  135.       if(groupName == "" || groupName == undefined)
  136.       {
  137.          return undefined;
  138.       }
  139.       var _loc2_ = this._parent[groupName];
  140.       if(_loc2_ == undefined)
  141.       {
  142.          var _loc0_ = null;
  143.          _loc2_ = this._parent[groupName] = new mx.controls.RadioButtonGroup();
  144.          _loc2_.__groupName = groupName;
  145.       }
  146.       _loc2_.addInstance(this);
  147.       if(this.__state)
  148.       {
  149.          _loc2_.selectedRadio.setState(false);
  150.          _loc2_.selectedRadio = this;
  151.       }
  152.    }
  153.    function get emphasized()
  154.    {
  155.       return undefined;
  156.    }
  157.    function keyDown(e)
  158.    {
  159.       switch(e.code)
  160.       {
  161.          case 40:
  162.             this.setNext();
  163.             break;
  164.          case 38:
  165.             this.setPrev();
  166.             break;
  167.          case 37:
  168.             this.setPrev();
  169.             break;
  170.          case 39:
  171.             this.setNext();
  172.       }
  173.    }
  174.    function setNext()
  175.    {
  176.       var _loc2_ = this._parent[this.groupName];
  177.       if(_loc2_.selectedRadio.indexNumber + 1 == _loc2_.radioList.length)
  178.       {
  179.          return undefined;
  180.       }
  181.       var _loc4_ = !_loc2_.selectedRadio ? -1 : _loc2_.selectedRadio.indexNumber;
  182.       var _loc3_ = 1;
  183.       while(_loc3_ < _loc2_.radioList.length)
  184.       {
  185.          if(_loc2_.radioList[_loc4_ + _loc3_] != undefined && _loc2_.radioList[_loc4_ + _loc3_].enabled)
  186.          {
  187.             var _loc5_ = this.getFocusManager();
  188.             _loc2_.radioList[_loc4_ + _loc3_].selected = true;
  189.             _loc5_.setFocus(_loc2_.radioList[_loc2_.selectedRadio.indexNumber]);
  190.             _loc2_.dispatchEvent({type:"click"});
  191.             break;
  192.          }
  193.          _loc3_ = _loc3_ + 1;
  194.       }
  195.    }
  196.    function setPrev()
  197.    {
  198.       var _loc2_ = this._parent[this.groupName];
  199.       if(_loc2_.selectedRadio.indexNumber == 0)
  200.       {
  201.          return undefined;
  202.       }
  203.       var _loc4_ = !_loc2_.selectedRadio ? 1 : _loc2_.selectedRadio.indexNumber;
  204.       var _loc3_ = 1;
  205.       while(_loc3_ < _loc2_.radioList.length)
  206.       {
  207.          if(_loc2_.radioList[_loc4_ - _loc3_] != undefined && _loc2_.radioList[_loc4_ - _loc3_].enabled)
  208.          {
  209.             var _loc5_ = this.getFocusManager();
  210.             _loc2_.radioList[_loc4_ - _loc3_].selected = true;
  211.             _loc5_.setFocus(_loc2_.radioList[_loc2_.selectedRadio.indexNumber]);
  212.             _loc2_.dispatchEvent({type:"click"});
  213.             break;
  214.          }
  215.          _loc3_ = _loc3_ + 1;
  216.       }
  217.    }
  218.    function set toggle(v)
  219.    {
  220.    }
  221.    function get toggle()
  222.    {
  223.    }
  224.    function set icon(v)
  225.    {
  226.    }
  227.    function get icon()
  228.    {
  229.    }
  230. }
  231.